package com.zd.controller;

import com.zd.domain.Reply;
import com.zd.domain.Result;
import com.zd.service.reply.ReplyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@RestController
@RequestMapping("/reply")
public class ReplyController {

    @Autowired
    private ReplyService replyService;

    @PostMapping("/saveReply")
    public Result saveReply(@RequestBody Reply reply){

        Result result = new Result();

        int i = replyService.saveReply(reply);

        if (i > 0){
            result.setCode(200);
            result.setMsg("添加成功！");
        }else {
            result.setCode(400);
            result.setMsg("添加失败！");
        }

        return result;

    }


}
